<?php defined('_JEXEC') or die('Restricted access'); ?>
<form action="<?php echo $this->baseurl ?>/index.php" method="post" name="adminForm">
<div id="editcell">
	<table class="adminlist">
		<thead>
			<tr>
				<th>
				</th>
				<th>
					<?php JText::printf("DESCRIPTION"); ?>
				</th>
				<th>
					<?php JText::printf("EVENT_DATES"); ?>
				</th>
				<th>
					<?php JText::printf("CREW"); ?>
				</th>
				<th>
					<?php JText::printf("CAN_BE_PERMANENTLY_DELETED"); ?>
				</th>
			</tr>
		</thead>
		<?php
		$k = 0;
		for ($i=0, $n=count( $this->eventGroupList ); $i < $n; $i++) {
			$record =& $this->eventGroupList[$i];
			?>
			<tr class="<?php echo "row$k"; ?>">
				<td>
					<?php echo JHTML::_('grid.id', $i, $record->id, false, 'id' ); ?>
				</td>
				<td>
					<?php echo $record->description; ?>
				</td>
				<td>
					<?php
					$dateArray = array();
					foreach ($record->eventList as $event) {
						$dateArray[] = date("j/n", strtotime($event->date));
					} 
					echo implode(", ", $dateArray);
					?>
				</td>
				<td>
					<?php
					$crewArray = array();
					foreach ($record->crewList as $crew) {
						$crewArray[] = $crew->name;
					}
					echo implode(", ", $crewArray);
					?>
				</td>
				<td>
					<?php
					if ($record->canDelete) {
						JText::printf("YES");
					}
					else {
						JText::printf("NO");
					}
					?>
				</td>
			</tr>
			<?php 
			$k = 1 - $k;
		}
		?>
		<tfoot>
			<tr>
				<td colspan="8"><?php echo $this->pageNav->getListFooter(); ?></td>
			</tr>
		</tfoot>
	</table>
</div>
<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
<input type="hidden" name="view" value="eventgroups" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
</form>
